<?php
$this->breadcrumbs=array(
	'单位'=>array('admin'),
	'管理',
);
?>

<div id="page-header">
	<h1><?php echo $this->moduleName; ?>管理</h1>
    <div id="page-options">
	<?php 
	if(Yii::app()->getModule('user')->isAdmin()){	
	$this->renderPartial('_menu',array(
    //'model'=>$model,
    ));}	
 ?>
    </div>
</div>

<?php 
if(Yii::app()->getModule('user')->isAdmin()){
	$this->renderPartial('element/_all',array(
		'provinces' => MtsysProvince::model()->findAll(),
		'citys' => MtsysCity::model()->findAll(),
		'countys' => MtsysCounty::model()->findAll(),
		'bases' => MtsysBase::model()->findAll(),
	));	
}else{ 
	switch($user->unit_level){
		case 1:
			$_view = '_prov';
			$_data = array(
				'province' => MtsysProvince::model()->findByPk($user->unit_id),
				'citys' => MtsysCity::model()->findAll('PROVINCE_ID=:PID',array(
					':PID' => $user->unit_id
				)),
				'countys' => MtsysCounty::model()->findAll(), 
			);
			break;		
		case 2:
			$_view = '_city';
			$_data = array(
				'citys' => MtsysCity::model()->findByPk($user->unit_id), 
				'countys' => MtsysCounty::model()->findAll(),
			);
			break;
		case 3:
			$_view = '_coun';
			$_data = array( 
				'countys' => MtsysCounty::model()->findByPk($user->unit_id),
			);
			break;
		default:
			$_view = '_no';
			$_data = array();
			break;
	}
	$this->renderPartial('element/'.$_view,$_data);	
}
?>